﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Description;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk;

namespace CrmServerConnection
{
    public class CrmConnectionData
    {
        public String ServerAddress;
        public String OrganizationName;
        public String UserName;
        public String Password;
        public Uri DiscoveryUri;
        public Uri OrganizationUri;
        public Uri CurrentOrganizationName{
            get {
                if (Ssl)
                {
                    return  new Uri(String.Format("https://{0}/{1}/XRMServices/2011/Organization.svc", ServerAddress,OrganizationName));   
                }
                else
                {
                    return  new Uri(String.Format("http://{0}/{1}/XRMServices/2011/Organization.svc", ServerAddress,OrganizationName));
                }
            }
        }
        public bool Ssl;
        public bool persistToFileLiveId = false;
        public bool isOffice365 = false;
        public ClientCredentials DeviceCredentials = null;
        public ClientCredentials Credentials = null;
        public AuthenticationProviderType EndpointType;
        public String UserPrincipalName;
        public IServiceManagement<IOrganizationService> OrganizationServiceManagement;
        public SecurityTokenResponse OrganizationTokenResponse;

    }
}
